package com.cpj.bsyyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cpj.bsyyzx.entity.HealthFile;
import com.cpj.bsyyzx.entity.KfRegister;
import com.cpj.bsyyzx.mapper.KfRegisterMapper;
import com.cpj.bsyyzx.service.IKfRegisterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 五个臭皮匠
 * @since 2021-04-27
 */
@Service
public class KfRegisterServiceImpl extends ServiceImpl<KfRegisterMapper, KfRegister> implements IKfRegisterService {

    @Override
    public boolean add(KfRegister kfRegister) {
        QueryWrapper<KfRegister> wrapper = new QueryWrapper<>();
        wrapper.eq("user_name", kfRegister.getUserName());

        KfRegister query = this.getOne(wrapper);
        if (query == null)
            return this.save(kfRegister);
        return false;
    }
}
